package com.paradogs.framework.core.utils;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author: yumi
 * @date: 2023/8/26  9:55
 * @Description: TODO
 */
@Slf4j
public class TimeUtils {

    public static long calcDuration(long startTime, TimeUnit timeUnit) {
        return  TimeUnit.MILLISECONDS.convert(System.currentTimeMillis() - startTime, timeUnit);
    }
    public static long calcDuration(long startTime) {
        return  calcDuration(startTime, TimeUnit.MILLISECONDS);
    }

}
